package com.example.demo2.server;

import com.example.demo2.dao.BookDao;
import com.example.demo2.model.BookInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServer {
    @Autowired
    BookDao bookDao ;

     List<BookInfo> list ;





//     设置借阅的状态
    public  List<BookInfo> getList() {
        list = bookDao.mockInfos();
//        遍历图书馆中的每一本书
        for (BookInfo book: list) {
            if(book.getStatus() == 0) {
                book.setStatusCN("不可借阅");
            } else {
                book.setStatusCN("可借阅");
            }
        }

        return list;
    }

}
